#include <iostream>
#include <include/frameprocessor.h>

using namespace std;

int main(int argc, char const *argv[])
{
    string pb_file_path = "../models/opencv_face_detector_uint8.pb";
    string pbtxt_file_path = "../models/opencv_face_detector.pbtxt";

    FrameProcessor processor(pb_file_path, pbtxt_file_path);
    VideoCapture cap(0);
    if (!cap.isOpened())
    {
        cerr << "Error: Could not open video capture." << endl;
        return -1;
    }

    Mat frame, resultFrame;
    while (true)
    {
        cap >> frame;
        if (frame.empty())
        {
            break;
        }
        processor.processFrame(frame, resultFrame);
        imshow("frame", resultFrame);
        int c = waitKey(1);
        if (c == 27)
        {
            break;
        }
    }

    cap.release();
    destroyAllWindows();
    return 0;
}